Statistical control of the integrity of a program

ABSTRACT

A method for controlling the execution of a program implementing successive operations, including, during program execution, comparing each operation with a pre-established list, and for each operation contained in the list, incrementing and memorizing a number of occurrences of this operation; and at the end of the program execution, comparing the number of occurrences of the current program execution for each operation with previously-stored ranges of numbers of occurrences assigned to each operation.

BACKGROUND OF THE INVENTION

[0001] 1. Field of the Invention

[0002] The present invention generally relates to the execution of programs (software codes) by an integrated microprocessor. The present invention more specifically relates to the control of the integrity of a program upon execution thereof, to check that the program has not been modified on purpose or incidentally since its installation. Such modifications may result from computer viruses or piracy attempts consisting, more specifically, of fault injections in the execution of programs.

[0003] 2. Discussion of the Related Art

[0004] A for example so-called trap fault injection attack may consist in the introduction of a disturbance on the processor supply for a short time. Such an attack causes an unexpected jump in the program execution sequence. Most often, such an attack occurs when the program has looped back or has stopped on a blocking instruction after an authentication failure, for example, in an application where a processor must decide whether a specific operation is allowed (for example, in the case of credit cards, the authorization of a bank transaction after authentication of the user).

[0005] Another type of attack affecting the execution of a cryptography algorithm consists of having the program counter jump to cause an unexpected jump in the execution sequence, even if the program has not stopped in a loop upon authentication. For example, for cryptography algorithms (DSA, RSA, DES, AES, etc.), the secret keys can be discovered by a piracy causing instruction jumps.

[0006] To protect the software code upon execution thereof, a periodic checking of this code is generally provided based on an authentication key stored in a memory or in the integrated circuit, for example, upon initial storage of the program or installation thereof.

[0007] For example, a signature (application of an encryption algorithm to at least a portion of the software code) is calculated upon installation or writing of the program. This signature is then stored in or outside of the integrated circuit executing the program. Then, upon execution of the software code, the operating system recalculates a signature based on the same algorithm as that having served to the generation of the initial signature. The current signature is then compared with the predetermined signature. A divergence between the two signatures means that the stored program has been modified and thus enables identifying a potential unwanted or incidental attack.

[0008] An example of such an integrity checking method is described in U.S. Pat. No. 5,442,645.

[0009] A disadvantage of known solutions is that in case of an updating of the software with a more recent version, it is then necessary to update the predetermined signature. Such an updating may be penalizing especially in case of a frequent updating of the system.

[0010] Further, program updatings more and more often occur via Internet-type communication networks, and it is not desirable to multiply signature calculations to be re- recorded in the integrated circuit on the user side.

[0011] Another disadvantage of conventional solutions is that the integrity checking is static, that is, at the beginning of the program, it is checked whether the signature is or not authorized. Accordingly, such a protection system is in practice inefficient in case of a fault injection during program execution.

SUMMARY OF THE INVENTION

[0012] The present invention aims at providing a method for checking the integrity of a program during execution which overcomes the disadvantages of known solutions.

[0013] The present invention especially aims at providing a solution which requires no updating of a signature upon each updating of the software code to be protected.

[0014] The present invention also aims at enabling dynamic checking, that is, which enables detecting fault injections during program execution.

[0015] To achieve these and other objects, the present invention provides a method for controlling the execution of a program implementing successive operations, consisting of:

[0016] during program execution, comparing each operation with a pre-established list, and for each operation contained in the list, incrementing and memorizing a number of occurrences of this operation; and

[0017] at the end of the program execution, comparing the number of occurrences of the current program execution for each operation with previously-stored ranges of numbers of occurrences assigned to each operation.

[0018] According to an embodiment of the present invention, said ranges of values are determined by analysis of the possible statistical differences of the numbers of occurrences with respect to one or several program executions.

[0019] According to an embodiment of the present invention, the numbers of current occurrences are stored in a table.

[0020] According to an embodiment of the present invention, the increment value is weighted according to the nature and/or the position of the operation in the program.

[0021] The present invention also provides a processor for executing a program, comprising an area for storing a table of numbers of operation occurrences upon execution of a program.

[0022] The foregoing objects, features, and advantages of the present invention will be discussed in detail in the following non-limiting description of specific embodiments in connection with the accompanying drawing, which very schematically illustrates an embodiment of the present invention.

DETAILED DESCRIPTION

[0023] For clarity, only those elements necessary to the understanding of the present invention have been shown and will be described hereafter. In particular, the operators or instructions concerned by the implementation of the present invention have not been detailed, and the present invention applies whatever the type of operator. Further, all the components necessary to the execution of a program, be it by means of a software implementation or by means of a state machine in wired logic, have not been detailed, their forming-using conventional elements.

[0024] A feature of the present invention is to cumulate during execution of a program to be monitored, the number of occurrences of operators, of instructions, or of groups of predetermined instructions and to control, at the end of the program execution, that the numbers of detected occurrences remain within a range of admitted values to consider that the program that has just been executed effectively is authentic.

[0025] Preferably, the ranges of authorized variations are statistically calculated according to the type of operator, of instruction, or of the operation group involved. For such a determination, account is especially taken of the mean frequency of occurrence of a given operation in a program.

[0026] Reference will be made hereafter to term “operator ” or “operation ” to designate the program elements having their number of occurrences, according to the present invention, monitored. Thus, an operation may be an operation code, an instruction, or an instruction group (for example, the access to a memory address or to a register, be it for a reading or a writing of data or for the execution of a stored code) and more generally any digital element likely to be monitored through its number of occurrences in a computer program.

[0027] Still according to a preferred embodiment, a table of occurrences of the operations to be monitored is calculated and is memorized in one or several program executions (for example, with random data) from which statistics are deduced or, as an alternative, upon its design or its installation.

[0028] The appended drawing very schematically illustrates in the form of blocks an embodiment of the method according to the present invention. This drawing illustrates the execution of a program to be monitored by the method of the present invention.

[0029] Upon starting of a program (block 1, START), some components are conventionally initialized (for example, the program counter). According to the present invention, advantage is taken of this initialization step (block 2, INIT(, Nb, . . . )) to initialize a memorized table of occurrences 10, inside or outside of the integrated circuit executing the program. Table 10 associates, according to the present invention, to each type TYPE of operation OPEi to be monitored, a number Nbi of occurrences of this operation upon execution of the program.

[0030] The occurrence table, and more specifically the types of operations to be monitored, are according to an embodiment, defined in the beginning of the executed program. As an alternative, for a given tool (integrated circuit), certain operations, the number of occurrences of which will be monitored whatever the program which happens to be executed, are predefined.

[0031] Conventionally, the execution of a program consists of a successive execution (block 3, EXECUTE Opj) of the different instructions, operators, or instruction groups until the end of the program. Thus, this execution may be symbolized with a loop in which it is proceeded to the execution of the next operator (block 4, NEXTj) each time an operation is over.

[0032] According to the present invention, within the execution loop, that is, just after the execution of an operation (block 3), a function (block 5, Nbi(OPj)+1) incrementing the number of occurrences of the current operation in table 10 is implemented.

[0033] The implementation of such a function is within the abilities of those skilled in the art based on the functional indications given in the present description. It is, in simplified fashion, a simple identity search function between the current operation and a pre- established list of table 10 and, if the operation corresponds to one from the list, the occurrence number counter is incremented in this table.

[0034] Once the program execution is over, that is, when there is no further operation OPj to be processed, the program linked to the actual application ends. A function (block 6 STAT Nb) specific to a preferred embodiment of the present invention which consists of extracting, from a memory, preferably non-volatile, from an external interrogation, for example, to a data server, etc., a predetermined table of statistic occurrences, is then executed.

[0035] The number of current occurrences of table 10 is then compared (block 7, COMP Nb) with the admitted range of values based on statistic table 6.

[0036] If the current numbers are comprised in the admissible ranges, the program ends (block 8, END) normally. In the opposite case, the method of the present invention generates a warning message (block 9, ERROR).

[0037] The reference table is, for example, calculated upon installation of the program or its first execution to determine the number of occurrences of the different operations significant for the implementation of the present invention.

[0038] The fact of collecting statistic information of occurrences of the program operations enables checking, in subsequent uses, that there is no statistically significant interval between the stored predetermined values and the current values. Thus, if a program updating is recorded on the concerned support, there is no reason for its statistical signature to be modified. However, if an attempt of piracy by fault injection occurs or if a virus introduction disturbs the program operation, the statistical signature will become different, which will enable detecting a kind of error probability. According to a specific embodiment, it is possible to only store the partial statistics concerning the program portion considered as being the most critical or the least liable to vary.

[0039] According to another embodiment, a time or position weighting in the program of the operation occurrence statistics may be used since, for example, as concerns computer viruses, it is known that the latter will modify with priority the beginning of the program to execute first and then leave place to the initial program. In this case, the first operation codes used will be assigned a greater weighting coefficient to more easily detect a fraud attempt.

[0040] For the selection of the operations, the number of occurrences of which is desired to be monitored, the operation type desired to be monitored may be taken into account. For example, if the method of the present invention is more specifically intended to detect the presence of a computer virus, it may be desired to more specifically monitor memory write operations, knowing that this type of operations is that performed in privileged fashion by a computer virus.

[0041] The choice of the types of operations, instructions, instruction groups, to be checked in terms of number of occurrences is within the abilities of those skilled in the art according to the application and to the type of program involved. For example, the number of external memory accesses, the number of multiplications, the number of random drawing loadings, etc. could be counted.

[0042] An advantage of the present invention is that in case of a program updating, the statistical signature remains the same. In particular, the operations constitutive of a DES-type algorithm (Data Encryption Standard) are not modified from one version to another.

[0043] Another advantage of the present invention is that the checking is performed at the end of the program execution. Thus, fault injections can be detected.

[0044] Of course, the present invention is likely to have various alterations, modifications, and improvements which will readily occur to those skilled in the art. In particular, the number and the type of operations depends on the program, the execution of which is desired to be monitored.

[0045] Further, the statistical tolerance acceptable for the numbers of occurrences of the monitored operations may correspond in practice to the threshold setting around a determined value upon first execution of the program. On this regard, it should be noted that the tolerance range around this value is not only used to enable installation of updatings without requiring a modification of the pre-recorded occurrence table, but also to take into account the fact that some operations may be executed a different number of times from one execution to the other of the software (for example, operators such as the number of times it is passed in a loop, which depends on input data, the number of squarings and of multiplications, which depends on the exponent of the modular exponentiation (so-called “Square-Multiply ” technique), or the number of executions of an elementary write function in a memory which depends on the size of the data to be written).

[0046] Such alterations, modifications, and improvements are intended to be part of this disclosure, and are intended to be within the spirit and the scope of the present invention. Accordingly, the foregoing description is by way of example only and is not intended to be limiting. The present invention is limited only as defined in the following claims and the equivalents thereto. 

What is claimed is:
 1. A method for controlling the execution of a program implementing successive operations comprising: during program execution, comparing each operation with a pre-established list, and for each operation contained in the list, incrementing and memorizing a number of occurrences of this operation; and at the end of the program execution, comparing the number of occurrences of the current program execution for each operation with previously-stored ranges of numbers of occurrences assigned to each operation, wherein said ranges of values are determined by analysis of the possible statistical deviations of the numbers of occurrences with respect to one or several program executions.
 2. Cancelled.
 3. The method of claim 1, wherein the numbers of current occurrences are stored in a table.
 4. The method of claim 1, wherein the increment value is weighted according to the nature and/or the position of the operation in the program.
 5. A processor for executing a program, comprising an area for storing a table of numbers of operation occurrences upon execution of a program, said table being used for the implementation of the method of claim
 1. 